﻿<form method="post">
    <div class="querybar">
        <table cellpadding="0" cellspacing="0" border="0" width="100%">
            <tr>
                <td>
                    标题：<input type="text" class="mytext" id="Title" name="Title" value="" />
                    分类：<select class="myselect" id="Type" name="Type"><option value="">==全部==</option>@Html.Raw(ViewData["typeOptions"])</select>
                    人员：<input type="text" user="true" dept="false" value="" station="false" unit="false" more="false" group="false" id="UserID" name="UserID" class="mymember" />
                    发生日期：<input type="text" class="mycalendar" id="Date1" name="Date1" style="width:90px;" value="" /> 至 <input type="text" class="mycalendar" id="Date2" name="Date2" style="width:90px;" value="" />
                    <input type="button" name="Search" onclick="query(null, 1);" value="&nbsp;&nbsp;查&nbsp;询&nbsp;&nbsp;" class="mybutton" />
                </td>
            </tr>
        </table>
    </div>
    <table id="listtable"></table>
    <div class="buttondiv"></div>
</form>
<script type="text/javascript">
    var appid = '@ViewData["appId"]';
    var iframeid = '@ViewData["tabId"]';
    var dialog = top.mainDialog || new RoadUI.Window();
    $(function ()
    {
        $("#listtable").jqGrid({
            url: "Query?appid=" + appid + "&tabid=" + iframeid,
            postData: { "appid": appid },
            mtype: 'post',
            datatype: "json",
            colNames: ['标题', '分类', '发生时间', '操作员', '发生IP', '详细'],
            colModel: [
                { name: 'Title', index: 'Title', width: 400 },
                { name: 'Type', index: 'Type', align: "left", width: 60 },
                { name: 'WriteTime', index: 'WriteTime', align: "left", width: 80 },
                { name: 'UserName', index: 'UserName', align: "left", width: 60 },
                { name: 'IPAddress', index: 'IPAddress', align: "left", width: 80 },
                { name: 'Opation', index: '', sortable: false, title: false, align: "left", width: 50 }
            ],
            sortname: "WriteTime",
            sortorder: "DESC",
            height: '100%',
            width: $(window).width(),
            loadComplete: function ()
            {
                var gridObj = $("#listtable");
                var records = gridObj.getGridParam("userData");
                $(".buttondiv").html(RoadUI.Core.getPager1(records.total, records.pagesize, records.pagenumber, "query"));
            }
        });
    });
    function query(size, number)
    {
        var data = {
            Title: $("#Title").val(), Type: $("#Type").val(), appid: appid,
            UserID: $("#UserID").val(), Date1: $("#Date1").val(), Date2: $("#Date2").val(),
            pagesize: size, pagenumber: number
        };
        $("#listtable").setGridParam({ postData: data }).trigger("reloadGrid");
    }
    $(window).resize(function ()
    {
        $("#listtable").setGridWidth($(window).width());
    });
    function detail(id)
    {
        dialog.open({ id: "window_" + appid.replaceAll('-', ''), title: "查看日志详细信息", width: 980, height: 590, url: "Detail?logid=" + id + '&appid=' + appid + '&tabid=' + iframeid, opener: window, openerid: iframeid });
    }
</script>